package org.jeecg.modules.simulator.model.orbit;

import lombok.Data;

import java.io.Serializable;

/**
 * @program: gp
 * @description:
 * @author: renzhg
 * @create: 2024-08-07 09:29
 **/
@Data
public class OrbitPoint implements Serializable, Comparable<OrbitPoint>, Cloneable {
    Integer index;
    String  belongingType;
    String  orbitName;
    String   stationId;
    String lineId;
    Long startOffsetDistance;
    Long endOffsetDistance;

    public Boolean getIsPositive(){
        if(startOffsetDistance>endOffsetDistance){
            return false;
        }else {
            return true;
        }
    }
    public Long getDistance(){
        return endOffsetDistance-startOffsetDistance;
    }

    @Override
    public int compareTo(OrbitPoint o) {
        return Integer.compare(this.index, o.index);
    }

    @Override
    public String toString() {
        String stype="";
        String stName="";
        stName=orbitName;
        if(this.belongingType.equals("station")){
            stype="station";
        }else{
            stype="sect";
        }
        return  "OrbitPoint->{"+
                "index:"+this.index+
                "type:"+stype+
                "Name"+stName+
                "}";


    }

    @Override
    public Object clone() {
        OrbitPoint OrbitPt = null;
        try{
            OrbitPt = (OrbitPoint)super.clone();
        }catch(CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return OrbitPt;
    }
}
